<?php
/**
 * Created by IntelliJ IDEA.
 * User: 张伯发
 * Date: 2019/7/31
 * Time: 15:14
 */

namespace App\Http\Controller\Happy;


use App\Model\Dao\Demo\BannerDao;
use App\Model\Dao\UserDao;
use Swoft\Bean\Annotation\Mapping\Inject;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;

/**
 *
 * @Controller("happy/db")
 * @package App\Http\Controller\Happy
 * @author 张伯发 2019/7/31 15:14
 */
class DbController
{

    /**
     * @Inject()
     * @var UserDao
     */
    private $userDao;

    /**
     * @Inject()
     * @var \App\Model\UserDao
     */
    private $userDao2;

    /**
     * @Inject()
     * @var BannerDao
     */
    private $bannerDao;


    /**
     *
     * @RequestMapping("findUser")
     * @return array
     * @throws \Swoft\Db\Exception\DbException
     * @author 张伯发 2019/7/31 15:18
     */
    public function findUser(): array
    {
        return $this->userDao->getUser(2);
    }


    /**
     * @RequestMapping("say")
     * @return array
     * @author 张伯发 2019/7/31 15:24
     */
    public function say(): array
    {
        return $this->userDao2->say();
    }


    /**
     * @RequestMapping("findBanner")
     * @return array
     * @throws \Swoft\Db\Exception\DbException
     * @author 张伯发 2019/7/31 15:43
     */
    public function findBanner() : array
    {
        return $this->bannerDao->findBanner(1);
    }

}

